<template>
    <div class="table">
        <myTable :list="tableList">
            <!-- slot-scope是固定的   scope 是一个随机定义的 scope可以获取到绑定在插槽上的所有属性 class  style除外-->
            <template slot-scope="scope">
                 <button @click="handleDel(scope)">删除</button>
                 <button >编辑</button>
            </template>
        </myTable>



        <!-- 跨域  -->
        <input type="text" v-model="keyWords">
        <button @click="send">发送请求</button>



    </div>
</template>
<script>
import myTable from '../components/myTable'
export default {
    data() {
        return {
            tableList:[{name:'鲁班',age:2000,hubby:'打游戏'},{name:'猪八戒',age:3000,hubby:'嫦娥'},{name:'孙悟空',age:5000,hubby:'打八戒'},{name:'唐僧',age:6000,hubby:'念紧箍咒'}],
            keyWords:'',//360搜索关键字
        }
    },
    methods: {
        handleDel(val){
          console.log(val);
        },
        // 发送请求
        send(){
             this.$axios.get('/api/suggest?word='+this.keyWords).then(res=>{
                console.log(res);
            })
        }
    },
    components:{myTable},
    created() {
       
    },
}
</script>